home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Reference Guide / C-C++ Interactive Reference Guide.iso / c_ref / csource5 / 349_01 / sss.arc / EX_0209.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1991-04-17  |  807 b   |  47 lines

  1. Program EX_0209;
  2. {Listing 3P - see documentation in TUTOR.SSS}
  3.  
  4. uses SSS;
  5. { For Pascal other than Turbo/Quick erase above line }
  6.  
  7. { For MS Pascal $include:'SSSP1.H' }
  8.  
  9. var
  10.   pt, pv, x : real;
  11.  
  12. { For MS Pascal $include:'SSSP2.H' }
  13.  
  14. function rnx(m, s: real): real;
  15. var x : real;
  16. begin
  17.   repeat
  18.     x := RN(m, s);
  19.   until x > 0.0;
  20.   rnx := x;
  21. end;
  22.  
  23. procedure prime;
  24. begin
  25.   INIQUE(0,0,2);
  26.   INISTA(1,'Call duration',0,12,2,0.5);
  27.   INISTA(2,'Cycle time',0,0,0,0);
  28.   pv := 0;
  29.   pt := rnx(7, 4);
  30. end;
  31.  
  32. begin
  33.   prime;
  34.   repeat
  35.     if RA < 0.25 then x := ER(2,2) else
  36.                       x := TR(1,3,4);
  37.     TALLY(1,x);
  38.     pt := pt + x;
  39.     TALLY(2, pt - pv);
  40.     pv := pt;
  41.     pt := pt + rnx(7, 4);
  42.   until pt >= 120;
  43.  
  44.   SUMRY('');
  45.   SUMRY('RESULTS');
  46. end.
  47.